package java;

import java.util.Optional;

/**
 * @author:谢君臣
 * @Date:2021/8/7-19:23
 * @version:1.0
 * @function:
 */
public class test {
    public static void main(String[] args) {
        person p = new person();
        p = null;
        Optional<person> optionalPerson = Optional.ofNullable(p);
        person person = optionalPerson.orElse(new person());
        System.out.println(person.test());
    }

}
class person{
    public person() {
    }
    public String test(){
        return "asdfa";
    }

}